Create table usuario
(cd_usuario numeric primary key,
nm_usuario varchar2(90),
qt_idade_usuario varchar2(2),
nm_email_usuario varchar2(60),
cd_registro_geral_usuario varchar2(12));

create table login_senha
(cd_login_senha numeric primary key,
nm_login varchar2(20),
nm_senha varchar2(16),
cd_usuario numeric,
CONSTRAINT log_fk FOREIGN KEY(cd_usuario)
REFERENCES usuario(cd_usuario));

Create table dog
(cd_dog numeric primary key,
nm_dog varchar2(25),
nm_raca_dog varchar2(25),
im_dog varchar2(30),
ds_dog varchar2(90),
ic_status_adocao_dog varchar(1),
ds_idade_dog varchar2(50));

CREATE SEQUENCE login_sequence
START WITH 1
INCREMENT BY 1;


CREATE OR REPLACE TRIGGER login_trigger
BEFORE INSERT
ON login_senha
REFERENCING NEW AS NEW
FOR EACH ROW
BEGIN
SELECT login_sequence.nextval INTO :NEW.cd_login_senha FROM dual;
END;
/

CREATE SEQUENCE usuario_sequence
START WITH 1
INCREMENT BY 1;


CREATE OR REPLACE TRIGGER usuario_trigger
BEFORE INSERT
ON usuario
REFERENCING NEW AS NEW
FOR EACH ROW
BEGIN
SELECT usuario_sequence.nextval INTO :NEW.cd_usuario FROM dual;
END;
/

CREATE SEQUENCE dog_sequence
START WITH 1
INCREMENT BY 1;


CREATE OR REPLACE TRIGGER dog_trigger
BEFORE INSERT
ON dog
REFERENCING NEW AS NEW
FOR EACH ROW
BEGIN
SELECT dog_sequence.nextval INTO :NEW.cd_dog FROM dual;
END;
/

INSERT INTO usuario (nm_usuario, qt_idade_usuario,nm_email_usuario,cd_registro_geral_usuario)
VALUES('Itay','27','renoturks@gmail.com','27.500.009-6');


INSERT INTO login_senha(nm_login,nm_senha,cd_usuario)
VALUES ('Reno','senha',1);


INSERT INTO dog(nm_dog, nm_raca_dog,ds_dog,ds_idade_dog,ic_status_adocao_dog)
VALUES ('Pitiula','Pastor Alemão','Carinhosa e cheio de vida, adora passear','Tem um ano e dois meses','N');